package com.fit.beans;

import java.util.LinkedList;
import java.util.List;
import com.fit.interfaces.*;
import com.fit.service.BuyUniqueID;
import com.fit.service.Buys;

public class BuyBean implements Buy {
	
	private String id;
	private List<Buy> buy;
	private Buyer buyer;
	private Worker Worker;
	public List<BuldingMaterials> buldingMaterials;

	public List<BuldingMaterials> getBuldingMaterials() {
		return buldingMaterials;
	}

	public void setBuldingMaterials(List<BuldingMaterials> buldingMaterials) {
		this.buldingMaterials = buldingMaterials;
	}

	public String getId() {
		return id;
	}
	
	public void setId(String id) {
		this.id = id;
	}

	public List<Buy> getBuy() {
		return buy;
	}
	
	public void setBuy(List<Buy> buy) {
		this.buy = buy;
	}

	public Buyer getBuyer() {
		return buyer;
	}
	
	public void setBuyer(Buyer buyer) {
		this.buyer = buyer;
	}

	public Worker getWorker() {
		return Worker;
	}
	
	public void setWorker(Worker Worker) {
		this.Worker =Worker;
	}
	
	public void executeBuyCreation(Worker worker, Buyer buyer,
			BuldingMaterials buldingMaterials, Buys buys) {
	
			this.setId(BuyUniqueID.getBuyUniqueID());
			this.setWorker(worker);
			this.setBuyer(buyer);
			
			List<BuldingMaterials> l = new LinkedList<BuldingMaterials>();
			l.add(buldingMaterials);
			
			this.setBuldingMaterials(l);
					
			buyer.getBuy().add(this);
			buldingMaterials.getBuy().add(this);
			buyer.getBuy().add(this);
			
			buys.save(this);
		}

}



